package cn.com.elite;

import java.util.List;

import javax.sql.DataSource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;

import cn.com.elite.util.Util;

public class EliteBean {
	private static final Log log=LogFactory.getLog(EliteBean.class);
	private DataSource dataSource;
    private DataSourceTransactionManager tran;
	public DataSource getDataSource() {
		return dataSource;
	}
	public void setDataSource(DataSource dataSource) {
		this.dataSource = dataSource;
	}
	public DataSourceTransactionManager getTran() {
		return tran;
	}
	public void setTran(DataSourceTransactionManager tran) {
		this.tran = tran;
	}
	public List chaxun_sql(String sql){
    	try{
    		JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
            List resultList=jdbcTemplate.queryForList(sql);
            return resultList;
		}catch(Exception e){
			log.error(sql+":"+Util.getERRO(e));
			return null;
		}
    }

}
